########## MACROS ###########################################################################
#############################################################################################

function(conan_message MESSAGE_OUTPUT)
    if(NOT CONAN_CMAKE_SILENT_OUTPUT)
        message(${ARGV${0}})
    endif()
endfunction()


macro(conan_find_apple_frameworks FRAMEWORKS_FOUND FRAMEWORKS FRAMEWORKS_DIRS)
    if(APPLE)
        foreach(_FRAMEWORK ${FRAMEWORKS})
            # https://cmake.org/pipermail/cmake-developers/2017-August/030199.html
            find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAMES ${_FRAMEWORK} PATHS ${FRAMEWORKS_DIRS} CMAKE_FIND_ROOT_PATH_BOTH)
            if(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND)
                list(APPEND ${FRAMEWORKS_FOUND} ${CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND})
            else()
                message(FATAL_ERROR "Framework library ${_FRAMEWORK} not found in paths: ${FRAMEWORKS_DIRS}")
            endif()
        endforeach()
    endif()
endmacro()


function(conan_package_library_targets libraries package_libdir deps out_libraries out_libraries_target build_type package_name)
    unset(_CONAN_ACTUAL_TARGETS CACHE)
    unset(_CONAN_FOUND_SYSTEM_LIBS CACHE)
    foreach(_LIBRARY_NAME ${libraries})
        find_library(CONAN_FOUND_LIBRARY NAMES ${_LIBRARY_NAME} PATHS ${package_libdir}
                     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
        if(CONAN_FOUND_LIBRARY)
            conan_message(STATUS "Library ${_LIBRARY_NAME} found ${CONAN_FOUND_LIBRARY}")
            list(APPEND _out_libraries ${CONAN_FOUND_LIBRARY})
            if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
                # Create a micro-target for each lib/a found
                string(REGEX REPLACE "[^A-Za-z0-9.+_-]" "_" _LIBRARY_NAME ${_LIBRARY_NAME})
                set(_LIB_NAME CONAN_LIB::${package_name}_${_LIBRARY_NAME}${build_type})
                if(NOT TARGET ${_LIB_NAME})
                    # Create a micro-target for each lib/a found
                    add_library(${_LIB_NAME} UNKNOWN IMPORTED)
                    set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${CONAN_FOUND_LIBRARY})
                    set(_CONAN_ACTUAL_TARGETS ${_CONAN_ACTUAL_TARGETS} ${_LIB_NAME})
                else()
                    conan_message(STATUS "Skipping already existing target: ${_LIB_NAME}")
                endif()
                list(APPEND _out_libraries_target ${_LIB_NAME})
            endif()
            conan_message(STATUS "Found: ${CONAN_FOUND_LIBRARY}")
        else()
            conan_message(STATUS "Library ${_LIBRARY_NAME} not found in package, might be system one")
            list(APPEND _out_libraries_target ${_LIBRARY_NAME})
            list(APPEND _out_libraries ${_LIBRARY_NAME})
            set(_CONAN_FOUND_SYSTEM_LIBS "${_CONAN_FOUND_SYSTEM_LIBS};${_LIBRARY_NAME}")
        endif()
        unset(CONAN_FOUND_LIBRARY CACHE)
    endforeach()

    if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
        # Add all dependencies to all targets
        string(REPLACE " " ";" deps_list "${deps}")
        foreach(_CONAN_ACTUAL_TARGET ${_CONAN_ACTUAL_TARGETS})
            set_property(TARGET ${_CONAN_ACTUAL_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES "${_CONAN_FOUND_SYSTEM_LIBS};${deps_list}")
        endforeach()
    endif()

    set(${out_libraries} ${_out_libraries} PARENT_SCOPE)
    set(${out_libraries_target} ${_out_libraries_target} PARENT_SCOPE)
endfunction()


########### FOUND PACKAGE ###################################################################
#############################################################################################

include(FindPackageHandleStandardArgs)

conan_message(STATUS "Conan: Using autogenerated FindLibevent.cmake")
set(Libevent_FOUND 1)
set(Libevent_VERSION "2.1.12")

find_package_handle_standard_args(Libevent REQUIRED_VARS
                                  Libevent_VERSION VERSION_VAR Libevent_VERSION)
mark_as_advanced(Libevent_FOUND Libevent_VERSION)

set(libevent_COMPONENTS libevent::extra libevent::openssl libevent::pthreads libevent::core)

if(Libevent_FIND_COMPONENTS)
    foreach(_FIND_COMPONENT ${Libevent_FIND_COMPONENTS})
        list(FIND libevent_COMPONENTS "libevent::${_FIND_COMPONENT}" _index)
        if(${_index} EQUAL -1)
            conan_message(FATAL_ERROR "Conan: Component '${_FIND_COMPONENT}' NOT found in package 'libevent'")
        else()
            conan_message(STATUS "Conan: Component '${_FIND_COMPONENT}' found in package 'libevent'")
        endif()
    endforeach()
endif()

########### VARIABLES #######################################################################
#############################################################################################


set(libevent_INCLUDE_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_INCLUDE_DIR "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_INCLUDES "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_RES_DIRS )
set(libevent_DEFINITIONS )
set(libevent_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)
set(libevent_COMPILE_DEFINITIONS )
set(libevent_COMPILE_OPTIONS_LIST "" "")
set(libevent_COMPILE_OPTIONS_C "")
set(libevent_COMPILE_OPTIONS_CXX "")
set(libevent_LIBRARIES_TARGETS "") # Will be filled later, if CMake 3
set(libevent_LIBRARIES "") # Will be filled later
set(libevent_LIBS "") # Same as libevent_LIBRARIES
set(libevent_SYSTEM_LIBS pthread)
set(libevent_FRAMEWORK_DIRS )
set(libevent_FRAMEWORKS )
set(libevent_FRAMEWORKS_FOUND "") # Will be filled later
set(libevent_BUILD_MODULES_PATHS )

conan_find_apple_frameworks(libevent_FRAMEWORKS_FOUND "${libevent_FRAMEWORKS}" "${libevent_FRAMEWORK_DIRS}")

mark_as_advanced(libevent_INCLUDE_DIRS
                 libevent_INCLUDE_DIR
                 libevent_INCLUDES
                 libevent_DEFINITIONS
                 libevent_LINKER_FLAGS_LIST
                 libevent_COMPILE_DEFINITIONS
                 libevent_COMPILE_OPTIONS_LIST
                 libevent_LIBRARIES
                 libevent_LIBS
                 libevent_LIBRARIES_TARGETS)

# Find the real .lib/.a and add them to libevent_LIBS and libevent_LIBRARY_LIST
set(libevent_LIBRARY_LIST event_extra event_openssl event_pthreads event_core)
set(libevent_LIB_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/lib")

# Gather all the libraries that should be linked to the targets (do not touch existing variables):
set(_libevent_DEPENDENCIES "${libevent_FRAMEWORKS_FOUND} ${libevent_SYSTEM_LIBS} OpenSSL::OpenSSL")

conan_package_library_targets("${libevent_LIBRARY_LIST}"  # libraries
                              "${libevent_LIB_DIRS}"      # package_libdir
                              "${_libevent_DEPENDENCIES}"  # deps
                              libevent_LIBRARIES            # out_libraries
                              libevent_LIBRARIES_TARGETS    # out_libraries_targets
                              ""                          # build_type
                              "libevent")                                      # package_name

set(libevent_LIBS ${libevent_LIBRARIES})

foreach(_FRAMEWORK ${libevent_FRAMEWORKS_FOUND})
    list(APPEND libevent_LIBRARIES_TARGETS ${_FRAMEWORK})
    list(APPEND libevent_LIBRARIES ${_FRAMEWORK})
endforeach()

foreach(_SYSTEM_LIB ${libevent_SYSTEM_LIBS})
    list(APPEND libevent_LIBRARIES_TARGETS ${_SYSTEM_LIB})
    list(APPEND libevent_LIBRARIES ${_SYSTEM_LIB})
endforeach()

# We need to add our requirements too
set(libevent_LIBRARIES_TARGETS "${libevent_LIBRARIES_TARGETS};OpenSSL::OpenSSL")
set(libevent_LIBRARIES "${libevent_LIBRARIES};OpenSSL::OpenSSL")

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})


########### COMPONENT core VARIABLES #############################################

set(libevent_core_INCLUDE_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_core_INCLUDE_DIR "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_core_INCLUDES "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_core_LIB_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/lib")
set(libevent_core_RES_DIRS )
set(libevent_core_DEFINITIONS )
set(libevent_core_COMPILE_DEFINITIONS )
set(libevent_core_COMPILE_OPTIONS_C "")
set(libevent_core_COMPILE_OPTIONS_CXX "")
set(libevent_core_LIBS event_core)
set(libevent_core_SYSTEM_LIBS pthread)
set(libevent_core_FRAMEWORK_DIRS )
set(libevent_core_FRAMEWORKS )
set(libevent_core_BUILD_MODULES_PATHS )
set(libevent_core_DEPENDENCIES )
set(libevent_core_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)

########### COMPONENT pthreads VARIABLES #############################################

set(libevent_pthreads_INCLUDE_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_pthreads_INCLUDE_DIR "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_pthreads_INCLUDES "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_pthreads_LIB_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/lib")
set(libevent_pthreads_RES_DIRS )
set(libevent_pthreads_DEFINITIONS )
set(libevent_pthreads_COMPILE_DEFINITIONS )
set(libevent_pthreads_COMPILE_OPTIONS_C "")
set(libevent_pthreads_COMPILE_OPTIONS_CXX "")
set(libevent_pthreads_LIBS event_pthreads)
set(libevent_pthreads_SYSTEM_LIBS )
set(libevent_pthreads_FRAMEWORK_DIRS )
set(libevent_pthreads_FRAMEWORKS )
set(libevent_pthreads_BUILD_MODULES_PATHS )
set(libevent_pthreads_DEPENDENCIES libevent::core)
set(libevent_pthreads_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)

########### COMPONENT openssl VARIABLES #############################################

set(libevent_openssl_INCLUDE_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_openssl_INCLUDE_DIR "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_openssl_INCLUDES "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_openssl_LIB_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/lib")
set(libevent_openssl_RES_DIRS )
set(libevent_openssl_DEFINITIONS )
set(libevent_openssl_COMPILE_DEFINITIONS )
set(libevent_openssl_COMPILE_OPTIONS_C "")
set(libevent_openssl_COMPILE_OPTIONS_CXX "")
set(libevent_openssl_LIBS event_openssl)
set(libevent_openssl_SYSTEM_LIBS )
set(libevent_openssl_FRAMEWORK_DIRS )
set(libevent_openssl_FRAMEWORKS )
set(libevent_openssl_BUILD_MODULES_PATHS )
set(libevent_openssl_DEPENDENCIES libevent::core OpenSSL::OpenSSL)
set(libevent_openssl_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)

########### COMPONENT extra VARIABLES #############################################

set(libevent_extra_INCLUDE_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_extra_INCLUDE_DIR "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_extra_INCLUDES "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/include")
set(libevent_extra_LIB_DIRS "/root/.conan/data/libevent/2.1.12/_/_/package/6e280ec897b4bbcee72ef217330d089521d5b8ef/lib")
set(libevent_extra_RES_DIRS )
set(libevent_extra_DEFINITIONS )
set(libevent_extra_COMPILE_DEFINITIONS )
set(libevent_extra_COMPILE_OPTIONS_C "")
set(libevent_extra_COMPILE_OPTIONS_CXX "")
set(libevent_extra_LIBS event_extra)
set(libevent_extra_SYSTEM_LIBS )
set(libevent_extra_FRAMEWORK_DIRS )
set(libevent_extra_FRAMEWORKS )
set(libevent_extra_BUILD_MODULES_PATHS )
set(libevent_extra_DEPENDENCIES libevent::core)
set(libevent_extra_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)


########## FIND PACKAGE DEPENDENCY ##########################################################
#############################################################################################

include(CMakeFindDependencyMacro)

if(NOT OpenSSL_FOUND)
    find_dependency(OpenSSL REQUIRED)
else()
    conan_message(STATUS "Conan: Dependency OpenSSL already found")
endif()


########## FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #######################################
#############################################################################################

########## COMPONENT core FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(libevent_core_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(libevent_core_FRAMEWORKS_FOUND "${libevent_core_FRAMEWORKS}" "${libevent_core_FRAMEWORK_DIRS}")

set(libevent_core_LIB_TARGETS "")
set(libevent_core_NOT_USED "")
set(libevent_core_LIBS_FRAMEWORKS_DEPS ${libevent_core_FRAMEWORKS_FOUND} ${libevent_core_SYSTEM_LIBS} ${libevent_core_DEPENDENCIES})
conan_package_library_targets("${libevent_core_LIBS}"
                              "${libevent_core_LIB_DIRS}"
                              "${libevent_core_LIBS_FRAMEWORKS_DEPS}"
                              libevent_core_NOT_USED
                              libevent_core_LIB_TARGETS
                              ""
                              "libevent_core")

set(libevent_core_LINK_LIBS ${libevent_core_LIB_TARGETS} ${libevent_core_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})

########## COMPONENT pthreads FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(libevent_pthreads_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(libevent_pthreads_FRAMEWORKS_FOUND "${libevent_pthreads_FRAMEWORKS}" "${libevent_pthreads_FRAMEWORK_DIRS}")

set(libevent_pthreads_LIB_TARGETS "")
set(libevent_pthreads_NOT_USED "")
set(libevent_pthreads_LIBS_FRAMEWORKS_DEPS ${libevent_pthreads_FRAMEWORKS_FOUND} ${libevent_pthreads_SYSTEM_LIBS} ${libevent_pthreads_DEPENDENCIES})
conan_package_library_targets("${libevent_pthreads_LIBS}"
                              "${libevent_pthreads_LIB_DIRS}"
                              "${libevent_pthreads_LIBS_FRAMEWORKS_DEPS}"
                              libevent_pthreads_NOT_USED
                              libevent_pthreads_LIB_TARGETS
                              ""
                              "libevent_pthreads")

set(libevent_pthreads_LINK_LIBS ${libevent_pthreads_LIB_TARGETS} ${libevent_pthreads_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})

########## COMPONENT openssl FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(libevent_openssl_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(libevent_openssl_FRAMEWORKS_FOUND "${libevent_openssl_FRAMEWORKS}" "${libevent_openssl_FRAMEWORK_DIRS}")

set(libevent_openssl_LIB_TARGETS "")
set(libevent_openssl_NOT_USED "")
set(libevent_openssl_LIBS_FRAMEWORKS_DEPS ${libevent_openssl_FRAMEWORKS_FOUND} ${libevent_openssl_SYSTEM_LIBS} ${libevent_openssl_DEPENDENCIES})
conan_package_library_targets("${libevent_openssl_LIBS}"
                              "${libevent_openssl_LIB_DIRS}"
                              "${libevent_openssl_LIBS_FRAMEWORKS_DEPS}"
                              libevent_openssl_NOT_USED
                              libevent_openssl_LIB_TARGETS
                              ""
                              "libevent_openssl")

set(libevent_openssl_LINK_LIBS ${libevent_openssl_LIB_TARGETS} ${libevent_openssl_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})

########## COMPONENT extra FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(libevent_extra_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(libevent_extra_FRAMEWORKS_FOUND "${libevent_extra_FRAMEWORKS}" "${libevent_extra_FRAMEWORK_DIRS}")

set(libevent_extra_LIB_TARGETS "")
set(libevent_extra_NOT_USED "")
set(libevent_extra_LIBS_FRAMEWORKS_DEPS ${libevent_extra_FRAMEWORKS_FOUND} ${libevent_extra_SYSTEM_LIBS} ${libevent_extra_DEPENDENCIES})
conan_package_library_targets("${libevent_extra_LIBS}"
                              "${libevent_extra_LIB_DIRS}"
                              "${libevent_extra_LIBS_FRAMEWORKS_DEPS}"
                              libevent_extra_NOT_USED
                              libevent_extra_LIB_TARGETS
                              ""
                              "libevent_extra")

set(libevent_extra_LINK_LIBS ${libevent_extra_LIB_TARGETS} ${libevent_extra_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})


########## TARGETS ##########################################################################
#############################################################################################

########## COMPONENT core TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET libevent::core)
        add_library(libevent::core INTERFACE IMPORTED)
        set_target_properties(libevent::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${libevent_core_INCLUDE_DIRS}")
        set_target_properties(libevent::core PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${libevent_core_LIB_DIRS}")
        set_target_properties(libevent::core PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${libevent_core_LINK_LIBS};${libevent_core_LINKER_FLAGS_LIST}")
        set_target_properties(libevent::core PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${libevent_core_COMPILE_DEFINITIONS}")
        set_target_properties(libevent::core PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${libevent_core_COMPILE_OPTIONS_C};${libevent_core_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## COMPONENT pthreads TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET libevent::pthreads)
        add_library(libevent::pthreads INTERFACE IMPORTED)
        set_target_properties(libevent::pthreads PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${libevent_pthreads_INCLUDE_DIRS}")
        set_target_properties(libevent::pthreads PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${libevent_pthreads_LIB_DIRS}")
        set_target_properties(libevent::pthreads PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${libevent_pthreads_LINK_LIBS};${libevent_pthreads_LINKER_FLAGS_LIST}")
        set_target_properties(libevent::pthreads PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${libevent_pthreads_COMPILE_DEFINITIONS}")
        set_target_properties(libevent::pthreads PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${libevent_pthreads_COMPILE_OPTIONS_C};${libevent_pthreads_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## COMPONENT openssl TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET libevent::openssl)
        add_library(libevent::openssl INTERFACE IMPORTED)
        set_target_properties(libevent::openssl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${libevent_openssl_INCLUDE_DIRS}")
        set_target_properties(libevent::openssl PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${libevent_openssl_LIB_DIRS}")
        set_target_properties(libevent::openssl PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${libevent_openssl_LINK_LIBS};${libevent_openssl_LINKER_FLAGS_LIST}")
        set_target_properties(libevent::openssl PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${libevent_openssl_COMPILE_DEFINITIONS}")
        set_target_properties(libevent::openssl PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${libevent_openssl_COMPILE_OPTIONS_C};${libevent_openssl_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## COMPONENT extra TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET libevent::extra)
        add_library(libevent::extra INTERFACE IMPORTED)
        set_target_properties(libevent::extra PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${libevent_extra_INCLUDE_DIRS}")
        set_target_properties(libevent::extra PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${libevent_extra_LIB_DIRS}")
        set_target_properties(libevent::extra PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${libevent_extra_LINK_LIBS};${libevent_extra_LINKER_FLAGS_LIST}")
        set_target_properties(libevent::extra PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${libevent_extra_COMPILE_DEFINITIONS}")
        set_target_properties(libevent::extra PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${libevent_extra_COMPILE_OPTIONS_C};${libevent_extra_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## GLOBAL TARGET ####################################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    if(NOT TARGET libevent::libevent)
        add_library(libevent::libevent INTERFACE IMPORTED)
    endif()
    set_property(TARGET libevent::libevent APPEND PROPERTY
                 INTERFACE_LINK_LIBRARIES "${libevent_COMPONENTS}")
endif()

########## BUILD MODULES ####################################################################
#############################################################################################
########## COMPONENT core BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${libevent_core_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
########## COMPONENT pthreads BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${libevent_pthreads_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
########## COMPONENT openssl BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${libevent_openssl_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
########## COMPONENT extra BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${libevent_extra_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
